<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>L2LB: Referência ao ficheiro nlb-driver.c</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Gerado por Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="annotated.html"><span>Estruturas&nbsp;de&nbsp;dados</span></a></li>
      <li class="current"><a href="files.html"><span>Ficheiros</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Referência ao ficheiro nlb-driver.c</h1>Arquivo main do L2LB. <a href="#_details">Mais...</a>
<p>
<code>#include &lt;linux/kernel.h&gt;</code><br>
<code>#include &lt;linux/module.h&gt;</code><br>
<code>#include &lt;linux/init.h&gt;</code><br>
<code>#include &lt;linux/skbuff.h&gt;</code><br>
<code>#include &lt;linux/netfilter_ipv4.h&gt;</code><br>
<code>#include &lt;linux/ip.h&gt;</code><br>
<code>#include &lt;linux/in.h&gt;</code><br>
<code>#include &lt;linux/if_ether.h&gt;</code><br>
<code>#include &lt;linux/inetdevice.h&gt;</code><br>
<code>#include &lt;linux/netdevice.h&gt;</code><br>
<code>#include &lt;linux/etherdevice.h&gt;</code><br>
<code>#include &lt;linux/vmalloc.h&gt;</code><br>
<code>#include &lt;linux/kthread.h&gt;</code><br>
<code>#include &lt;linux/delay.h&gt;</code><br>
<code>#include &lt;linux/net.h&gt;</code><br>
<code>#include &lt;linux/socket.h&gt;</code><br>
<code>#include &lt;linux/errno.h&gt;</code><br>
<code>#include &lt;linux/types.h&gt;</code><br>
<code>#include &lt;linux/moduleparam.h&gt;</code><br>
<code>#include &quot;<a class="el" href="utils_8h-source.html">utils.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="cluster_8h-source.html">cluster.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="hash-afinidades_8h-source.html">hash-afinidades.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="socket_8h-source.html">socket.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="heartbeat_8h-source.html">heartbeat.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="thread_8h-source.html">thread.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="interface_8h-source.html">interface.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="netfilter_8h-source.html">netfilter.h</a>&quot;</code><br>

<p>
<a href="nlb-driver_8c-source.html">Ir para o código fonte deste ficheiro.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Funções</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="nlb-driver_8c.html#a6bb443824ee776be4a7a888f204b1d2">dev_cluster_hard_start_xmit_new</a> (struct sk_buff *skb, struct net_device *<a class="el" href="nlb-driver_8c.html#312f6a236fcec7f8803e170412fb3f86">dev</a>)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wrapper do metodo dev.hard_start_xmit_old() implementado pelo driver rede responsavel por enviar o pacote de rede.  <a href="#a6bb443824ee776be4a7a888f204b1d2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="nlb-driver_8c.html#58c1436a949928f231d221233cd6c274">nlb_init_module</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Incializa o modulo do kernel.  <a href="#58c1436a949928f231d221233cd6c274"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="nlb-driver_8c.html#252459a2361783e1bd1da46b46c2bdf6">nlb_exit_module</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Desregistra o modulo.  <a href="#252459a2361783e1bd1da46b46c2bdf6"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Variáveis</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="nlb-driver_8c.html#312f6a236fcec7f8803e170412fb3f86">dev</a> [9]</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Interface de rede do <a class="el" href="structcluster.html" title="Cluster.">cluster</a> que sera gerenciada pelo L2LB.  <a href="#312f6a236fcec7f8803e170412fb3f86"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static char&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="nlb-driver_8c.html#c8f175c78fae68f5348eab7bcc8ca54b">ip</a> [17]</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">IP virtual do <a class="el" href="structcluster.html" title="Cluster.">cluster</a>.  <a href="#c8f175c78fae68f5348eab7bcc8ca54b"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Descrição detalhada</h2>
Arquivo main do L2LB. 
<p>
Este arquivo eh responsavel por registrar/desregistrar o modulo no kernel do linux 
<p>Definido no ficheiro <a class="el" href="nlb-driver_8c-source.html">nlb-driver.c</a>.</p>
<hr><h2>Documentação das funções</h2>
<a class="anchor" name="a6bb443824ee776be4a7a888f204b1d2"></a><!-- doxytag: member="nlb-driver.c::dev_cluster_hard_start_xmit_new" ref="a6bb443824ee776be4a7a888f204b1d2" args="(struct sk_buff *skb, struct net_device *dev)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int dev_cluster_hard_start_xmit_new           </td>
          <td>(</td>
          <td class="paramtype">struct sk_buff *&nbsp;</td>
          <td class="paramname"> <em>skb</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct net_device *&nbsp;</td>
          <td class="paramname"> <em>dev</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Wrapper do metodo dev.hard_start_xmit_old() implementado pelo driver rede responsavel por enviar o pacote de rede. 
<p>
Este metodo remonta o cabecalho do pacote na camada de enlace para os pacotes que estao sendo enviados pela interface de rede do <a class="el" href="structcluster.html" title="Cluster.">cluster</a>.<p>
No L2LB, o cabecalho do pacote da resposta na camada de enlace tem como remetente outra interface de rede, que nao a interface de rede do <a class="el" href="structcluster.html" title="Cluster.">cluster</a>, por onde a requisicao foi recebida. Isto eh necessario para impedir que os swicths de rede apredam uma rota para o IP virtual do <a class="el" href="structcluster.html" title="Cluster.">cluster</a>, uma vez que o IP virtual do <a class="el" href="structcluster.html" title="Cluster.">cluster</a> eh compartilhado por varias maquinas na LAN. Desta forma todos os servidores do <a class="el" href="structcluster.html" title="Cluster.">cluster</a> sempre receberao todas as mensagem enderecadas para o seu IP virtual.<p>
<dl compact><dt><b>Parâmetros:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>skb</em>&nbsp;</td><td>Pacote </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>dev</em>&nbsp;</td><td>Interface de rede </td></tr>
  </table>
</dl>

<p>Definido na linha <a class="el" href="nlb-driver_8c-source.html#l00080">80</a> do ficheiro <a class="el" href="nlb-driver_8c-source.html">nlb-driver.c</a>.</p>

<p>Referências <a class="el" href="structcluster.html#088588314045ccef65ac5c6b72d5e37d">cluster::hard_start_xmit_old</a>, <a class="el" href="cluster_8h-source.html#l00045">cluster::mac_response</a> e <a class="el" href="cluster_8h.html#1917b2709741dea7ce5cf6ea441686ed">my_cluster</a>.</p>

<p>Referenciado por <a class="el" href="nlb-driver_8c-source.html#l00100">nlb_init_module()</a>.</p>

</div>
</div><p>
<a class="anchor" name="252459a2361783e1bd1da46b46c2bdf6"></a><!-- doxytag: member="nlb-driver.c::nlb_exit_module" ref="252459a2361783e1bd1da46b46c2bdf6" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void nlb_exit_module           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Desregistra o modulo. 
<p>

<p>Definido na linha <a class="el" href="nlb-driver_8c-source.html#l00130">130</a> do ficheiro <a class="el" href="nlb-driver_8c-source.html">nlb-driver.c</a>.</p>

<p>Referências <a class="el" href="hash-afinidades_8h-source.html#l00113">hash_exit()</a>, <a class="el" href="cluster_8h-source.html#l00265">nlb_cluster_exit()</a>, <a class="el" href="netfilter_8h-source.html#l00084">nlb_netfilter_exit()</a> e <a class="el" href="thread_8h-source.html#l00045">nlb_thread_exit()</a>.</p>

</div>
</div><p>
<a class="anchor" name="58c1436a949928f231d221233cd6c274"></a><!-- doxytag: member="nlb-driver.c::nlb_init_module" ref="58c1436a949928f231d221233cd6c274" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static int nlb_init_module           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Incializa o modulo do kernel. 
<p>
Esta funcao eh responsavel por:<ul>
<li>Inicializar o <a class="el" href="structcluster.html" title="Cluster.">cluster</a>. <a class="el" href="cluster_8h.html#33d0ab81e5ab7cf05146cead194236b7" title="Inicializa a estrutura my_cluster.">init_cluster()</a></li><li>Inicializar a interface com o modulo atraves do sistema de arquivo \proc. <a class="el" href="interface_8h.html#65a3f35a0907ebf967e1f54265516827" title="Inicializa a interface do cluster criando o arquivo /proc/nlb.">init_proc_interface()</a></li><li>Inicializar a tabela de afinidades. <a class="el" href="hash-afinidades_8h.html" title="Arquivo responsável por gerenciar as afinidades entre os clientes e os servidores...">hash-afinidades.h</a></li><li>Inicializar um thread para comunicacao entre os servidores do <a class="el" href="structcluster.html" title="Cluster.">cluster</a>. <a class="el" href="thread_8h.html" title="Arquivo responsável pela criação de threads.">thread.h</a></li><li>Inicializar os HOOKS do Netfilter. <a class="el" href="netfilter_8h.html#bf19d764f0af6d861e95cb83707589a7" title="Inicializa a interceptação dos pacotes com o Netfilter.">nlb_netfilter_init()</a> </li></ul>

<p>Definido na linha <a class="el" href="nlb-driver_8c-source.html#l00100">100</a> do ficheiro <a class="el" href="nlb-driver_8c-source.html">nlb-driver.c</a>.</p>

<p>Referências <a class="el" href="nlb-driver_8c-source.html#l00051">dev</a>, <a class="el" href="nlb-driver_8c-source.html#l00080">dev_cluster_hard_start_xmit_new()</a>, <a class="el" href="hash-afinidades_8h-source.html#l00088">hash_init()</a>, <a class="el" href="cluster_8h-source.html#l00214">init_cluster()</a>, <a class="el" href="interface_8h-source.html#l00162">init_proc_interface()</a>, <a class="el" href="nlb-driver_8c-source.html#l00056">ip</a>, <a class="el" href="cluster_8h-source.html#l00045">cluster::mac_response</a>, <a class="el" href="cluster_8h.html#1917b2709741dea7ce5cf6ea441686ed">my_cluster</a>, <a class="el" href="netfilter_8h-source.html#l00069">nlb_netfilter_init()</a>, <a class="el" href="thread_8h-source.html#l00016">nlb_thread_init()</a> e <a class="el" href="utils_8h-source.html#l00014">printk_mac_addr()</a>.</p>

</div>
</div><p>
<hr><h2>Documentação das variáveis</h2>
<a class="anchor" name="312f6a236fcec7f8803e170412fb3f86"></a><!-- doxytag: member="nlb-driver.c::dev" ref="312f6a236fcec7f8803e170412fb3f86" args="[9]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char <a class="el" href="nlb-driver_8c.html#312f6a236fcec7f8803e170412fb3f86">dev</a>[9]<code> [static]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Interface de rede do <a class="el" href="structcluster.html" title="Cluster.">cluster</a> que sera gerenciada pelo L2LB. 
<p>

<p>Definido na linha <a class="el" href="nlb-driver_8c-source.html#l00051">51</a> do ficheiro <a class="el" href="nlb-driver_8c-source.html">nlb-driver.c</a>.</p>

<p>Referenciado por <a class="el" href="nlb-driver_8c-source.html#l00100">nlb_init_module()</a>.</p>

</div>
</div><p>
<a class="anchor" name="c8f175c78fae68f5348eab7bcc8ca54b"></a><!-- doxytag: member="nlb-driver.c::ip" ref="c8f175c78fae68f5348eab7bcc8ca54b" args="[17]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char <a class="el" href="nlb-driver_8c.html#c8f175c78fae68f5348eab7bcc8ca54b">ip</a>[17]<code> [static]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
IP virtual do <a class="el" href="structcluster.html" title="Cluster.">cluster</a>. 
<p>

<p>Definido na linha <a class="el" href="nlb-driver_8c-source.html#l00056">56</a> do ficheiro <a class="el" href="nlb-driver_8c-source.html">nlb-driver.c</a>.</p>

<p>Referenciado por <a class="el" href="nlb-driver_8c-source.html#l00100">nlb_init_module()</a>.</p>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Gerado em Wed Sep 10 23:05:56 2008 para L2LB por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
